Arrangements for antialiasing coverage computation

ABSTRACT

Improved arrangements for antialiasing coverage computations, useable in numerous embodiments, a non-exhaustive/non-limiting listing including graphics chips, chipsets, systems, methods and software embodiments.

FIELD

[0001] The present invention is directed to improved arrangements forantialiasing coverage computation.

BACKGROUND

[0002] As background to ensure familiarity with the term and concept,antialiasing is a graphical corrective measure in which the jagged edgesof displayed lines, letters, numerals, etc., are attempted to besmoothed or rounded, so as to make them appear more visually continuoussuch that they look more like smooth lines, letters, numerals, etc.,rather than jagged ones made from steps or blocks. An arrangement mayaccomplish this by calculating and placing pixels of appropriate shadinglevels in jagged areas where smoothing or rounding is desired to takeplace.

[0003] Ideal (i.e., perfect) antialiasing requires intensive resources(e.g., very complex hardware designs) which may not be cost-effective inthe marketplace. Accordingly, less than ideal antialiasing arrangementsmay be used for affordable, but less-than-perfect antialiasing. What areneeded are continued improvements in affordable antialiasingarrangements.

BRIEF DESCRIPTION OF THE DRAWINGS

[0004] The foregoing and a better understanding of the present inventionwill become apparent from the following detailed description of exampleembodiments and the claims when read in connection with the accompanyingdrawings, all forming a part of the disclosure of this invention. Whilethe foregoing and following written and illustrated disclosure focuseson disclosing example embodiments of the invention, it should be clearlyunderstood that the same is by way of illustration and example only andthat the invention is not limited thereto. The spirit and scope of thepresent invention are limited only by the terms of the appended claims.

[0005] The following represents brief descriptions of the drawings,wherein:

[0006] FIGS. 1-2 are graphical depictions of example line segments, suchdepictions being useful in gaining a more thoroughunderstanding/appreciation of background as well as example embodimentsof the present invention;

[0007]FIG. 3 is a graphical depiction of an example antialiased linepixel sampling applied to an example line segment using polygon samplingrules, such depiction being useful in gaining a more thoroughunderstanding/appreciation of background as well as example embodimentsof the present invention;

[0008] FIGS. 4-9 are graphical depictions concerning theoreticalcoverages, such depictions being useful in gaining a more thoroughunderstanding/appreciation of background as well as example embodimentsof the present invention;

[0009]FIG. 10 is a block diagram illustrating an example personalcomputer (PC) system embodiment of the present invention;

[0010]FIG. 11 is a block diagram illustrating an example graphics andmemory controller hub (GMCH) embodiment, useable, for example, with theFIG. 10 example embodiment;

[0011]FIG. 12 is an example flowchart concerning an example methodembodiment of the present invention, useable, for example, with theFIGS. 10-11 example embodiments;

[0012]FIG. 13 is an example flowchart concerning example operationsconducted by a 3D engine of the FIGS. 10-11 example embodiments; and

[0013]FIG. 14 is an example flowchart concerning example operationsconducted with respect to the FIG. 13 rasterization operation.

DETAILED DESCRIPTION

[0014] Before beginning a detailed description of the subject invention,mention of the following is in order. When appropriate, like referencenumerals and characters may be used to designate identical,corresponding or similar components in differing figure drawings.Further, in the detailed description to follow, examplesizes/models/values/ranges may be given, although the present inventionis not limited to the same. Example arbitrary axes (e.g., X-axis, Y-axisand/or Z-axis) may be discussed/illustrated, although practice ofembodiments of the present invention is not limited thereto (e.g.,differing axes directions may be able to be assigned). Well knownpower/ground connections to ICs and other components may not be shownwithin the FIGS. for simplicity of illustration and discussion, and soas not to obscure the invention. Further, arrangements may be shown inblock diagram form in order to avoid obscuring the invention, and alsoin view of the fact that specifics with respect to implementation ofsuch block diagram arrangements are highly dependent upon the platformWithin which the present invention is to be implemented, i.e., suchspecifics should be well within the purview of one skilled in the art.Where specific details (e.g., circuits, flowcharts) are set forth inorder to describe example embodiments of the invention, it should beapparent to one skilled in the art that the invention can be practicedwithout, or with variation of, these specific details.

[0015] Although example embodiments of the present invention will bedescribed using example antialiasing arrangements for rendering lines orline segments in a graphics accelerator device, neither practice of thepresent invention nor a scope of the appended claims is limited thereto.For example, practice and a scope covers the rendering of more complexgraphical objects such as letters, numerals, etc. For example,antialiasing may be applicable to edges of such objects, especiallyconsidering the fact that the edges of such complex objects may beenvisioned/processed as being formed of a plurality of line segments.Throughout the disclosure and claims, the term “line” may be usedgenerically to reference a generic item subjected to antialiasing (e.g.,lines, line segments, edges, etc. antialiasing). As further discussion,practice and a scope of the present invention is not limited to purelyhardware arrangements (e.g., graphics accelerator devices) or purelysoftware arrangements, and in fact, the invention may be practiced ineither arrangement or with many different hardware/softwarecombinations.

[0016] Beginning the detailed description, FIG. 1 is a graphicaldepiction of an example line segment, such depiction being useful ingaining a more thorough understanding/appreciation of background as wellas example embodiments of the present invention. Within FIG. 1 (andsimilar FIGS.), pixel grid rectangles (e.g., 101, 102) are shownarranged in a grid array.

[0017] Within FIG. 1, an example line segment in a 3D graphics systemcan be envisioned as being a plurality of points interconnected betweentwo end points and having a width associated therewith. An “ideal”line-rendering algorithm draws a line segment as a rectangle, i.e., asshown representatively by the shaded rectangle in FIG. 1. In thisexample, the line segment itself defines the width of the rectangle byconnecting the midpoints of two of the edges. The height of therectangle being drawn is given by a line width programmed by a graphicsapplication using a standard graphics API. In the industry standardOpenGL®API, the line width is programmed by calling the functionglLineWidth( ).

[0018] During display, such a line may contribute to the brightness ofall pixels that intersect the rectangle. The brightness contributed toeach pixel may be equal to the percentage of the pixel grid rectanglearea covered by the line segment rectangle. For example, pixel gridrectangles (e.g., 115; FIG. 1) fully or mostly covered by the linesegment get a full contribution, whereas pixel grid rectangles (e.g.,107) that are barely touched get very little contribution. Accordingly,a brightness depends upon an amount of a pixel grid rectangle areacovered by the expanded line.

[0019] In practice, it is computationally expensive to compute thecoverage of each pixel touched using an ideal line rasterizationalgorithm. Instead, actual implementations (such as the presentinvention) generally attempt to approximate the coverage of the idealline rasterization algorithm for economy purposes.

[0020] As one disadvantageous approach, one of the lowest-qualityapproximations contributes full brightness to exactly one pixel in eachrow or column, for example, as shown in FIG. 2. These lines, referred toas aliased lines, require fewer computational resources to draw, and socan generally be drawn with higher performance (i.e., faster) thanantialiased lines. Accordingly, such a drawing algorithm may be thedefault line-rendering algorithm in, for example, low-end graphicsaccelerators. Despite the low cost, a tradeoff is that such algorithmmay produce lines with obviously jagged edges. Moreover, such lines willflicker when they move. These problems are commonly referred to as “thejaggies” or aliasing artifacts.

[0021] Because jaggies or artifacts are unacceptable in a wide range ofgraphics applications, it is highly desirable for graphics hardware toimplement a higher quality antialiasing algorithm. More particularly,more advantageous line antialiasing algorithms may attempt to achievethe following enumerated Goals (all of which are achieved by an actualideal algorithm):

[0022] 1. Draw lines without visible “jaggies”;

[0023] 2. Lines should be rendered with a total brightness approximatelyequal to the area of the rectangle (sum of the computed coverages shouldclosely match the ideal coverage);

[0024] 3. The total brightness of the line should be independent of aline's orientation, i.e., a diagonal line should have the same overallbrightness as a vertical or horizontal line of the same length, eventhough it spans fewer columns or rows; and

[0025] 4. The coverage computed for each pixel should be equal to thearea of the intersection of the rectangle corresponding to the line andthe square corresponding to the pixel.

[0026] Some graphics accelerators may render antialiased lines asrectangles using essentially the same hardware used to draw polygons,i.e., using polygon sampling. Such algorithm attempts to match the“ideal” computational model in that they both draw rectangles. However,the hardware draws a polygon subject to normal polygon sampling rules,and only lights pixels whose centers are covered by the rectangle. Incontrast, the “ideal” algorithm lights all pixels that are touched atall by the rectangle.

[0027] To more closely match the ideal algorithm, the antialiased linedrawing algorithm may draw an expanded rectangle as shown in FIG. 3.More particularly, FIG. 3 graphically illustrates an example ofantialiased line pixel sampling using polygon sampling rules. FIG. 3illustrates example (shaded) pixels which each have its pixel center hitby both a normal (unexpanded) rectangle 310 and an expanded rectangle320 using the normal polygon sampling rules. As examples, pixel 302(first type of shading) is one having its pixel center covered by boththe normal rectangle 310 and expanded rectangle 320, pixel 304 (secondtype of shading) is one covered by the expanded rectangle 320 but missedby the normal rectangle 310, and finally, pixel 306 (un-shaded) is onehaving its pixel center missed by both the normal rectangle 310 and theexpanded rectangle 320.

[0028] The pixels hit by ideal algorithm are those that are touched atall by the unexpanded rectangle. In theory, this expanded rectanglealgorithm advantageously leverages the polygon rasterization hardware totouch approximately the same pixels as an ideal antialiasedline-rendering algorithm. One example approach is as follows:

[0029] For each line or edge, the hardware computes a quantity Lo′(x,y)at each pixel (x,y), where:

Lo′(x,y)=(ΔY/(ΔX+ΔY))*(x−x0)+(ΔX/(ΔX+ΔY))*(y−y0)  (Eq. Ln. 1)

[0030] In this formulation, (x,y) gives the coordinates of the pixelcenter, (x0,y0) and (x1,y1) are the endpoints of the line, and ΔX and ΔYare defined as x1−x0 and y1−y0, respectively. The actual line is definedby the set of (x,y) values, where Lo′(x,y)=0. To generate two rectangleedges parallel to the line, in a semi-advantageous arrangement, let:

Lo1(x,y)=Lo′(x,y)+K, and  (Eq. Ln. 2)

Lo2(x,y)=K−Lo′(x,y),  (Eq. Ln. 3)

[0031] where K=(w+1)/2, and w is the programmed width of the line inpixels. The area between the two edges is given by the set of points(x,y), where Lo1(x,y)>0 and Lo2(x,y)>0.

[0032] The coverage applied to a pixel centered at (x,y) correspondingto a given rectangle edge is: $\begin{matrix}{{C = 0},} & {{{{if}\quad {{Lo}\left( {x,\quad y} \right)}} < {0,}}} & {\left( {{Eq}.\quad {Ln}.\quad 4} \right)} \\{= {{{Lo}\left( {x,\quad y} \right)},}} & {{{{{if}\quad 0}<={{Lo}\left( {x,\quad y} \right)} < 1},{and}}} & {\left( {{Eq}.\quad {Ln}.\quad 5} \right)} \\{{= 1},} & {{{{if}\quad {{Lo}\left( {x,\quad y} \right)}} > 1.}} & {{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\left( {{Eq}.\quad {Ln}.\quad 6} \right)}\end{matrix}$

[0033] For each pixel covered by the expanded rectangle, coverages arecomputed against the four rectangle edges and combined (bymultiplication) to yield a final coverage.

[0034] Turning now to further analysis, a quality of the algorithmmethod can be analyzed using a column sum metric, which is defined asthe sum of the coverage values in a given column of pixels. This metricwill give a reasonable indication of whether or not the brightness ofthe line matches the area of the rectangle used in the ideal algorithm.However, the column sum metric as applied here has several limitations,such as:

[0035] This metric ignores the influence of end caps, which are theedges perpendicular to the line. It assumes that the line issufficiently long for the end caps to have no influence on the columntested. The end caps are believed not to be a problem in thesemi-advantageous algorithm;

[0036] This metric works on only X-major lines (where the difference inX is larger than that in Y). An equivalent row sum metric can be usedfor Y-major lines; and

[0037] The semi-advantageous method does not produce constant columnsums; i.e., some columns can be brighter than others, depending on theposition of the line. To compensate for this effect, an average columnsum may be used, which is the average of the column sums for the sameline as it is shifted up and down by fractions of pixels.

[0038] Under the semi-advantageous method, the average column sum isw*(1+|tan ?|), where ? the angle between the line and the X axis. Themethod used to derive this value will be discussed hereinbelow, as wellas some made analysis of the variance of the non-constant column sumsresulting from the semi-advantageous method.

[0039] Under the method described above, the column sum is the area ofthe intersection of the rectangle corresponding to the line and thecolumn of pixels. The intersection, discussed ahead (FIG. 4 andassociated discussion), is a parallelogram with a width of 1 and aheight of w/cos θ, where w is the width of the line and θ (or ?) is theangle between the line and the X axis. The area/column sum for the idealmethod is therefore w/cos ?.

[0040] For horizontal lines (θ=0°), the semi-advantageous methodproduces the same column sum as the ideal method. However, for diagonallines (e.g., θ=45°), the average coverage of a 1-pixel wide line is 2.0using the semi-advantageous method, versus 1.414 for the ideal method.In general, diagonal lines produced by the semi-advantageous method aretoo bright. In addition, the overall brightness of a line changessignificantly as it is rotated. In summary, the semi-advantageous methodfails to satisfy a number of the Goals (in particular, Goals 2 and 3)which were enumerated previously.

[0041] Turning now to advantageous embodiments, such improve on thesemi-advantageous method in that the embodiments use a different choiceof the Lo modifier K specified above. Recall that in thesemi-advantageous method, K is set to (w+1)/2, where w is the actualwidth of the line. In the advantageous method, K is instead chosen as:

K=w/2*(1(cos ?+sin ?)+½.  (Eq. Ln. 7)

[0042] This value of K was chosen to achieve results that closely matchthe ideal method, while continuing to use the basic logic behind thesemi-advantageous algorithm. Again, the rationale behind the choice ofthis constant is described in detail in supporting disclosure ahead. Themethod used in hardware to generate 1/(cos θ+sin θ) most likely would bean approximation using a small number of bits of the ΔX and ΔY terms.That is, the value K is dependent on the ?X and ?Y terms, and can becomputed by rasterization hardware in a number of different ways. In oneexample embodiment, hardware identifies the most significant bits in thetwo terms and uses these bits to extract the volume of 1/(cos sin ?+sin?) from a table of precomputed values.

[0043] In the supporting disclosure ahead, a detailed example isprovided using a 1-pixel line at a 26.56 degree angle from the X-axis,where tan ? is ½. In quality analysis using the 26.56 degree angle, theaverage column sum is 1.141 using the advantageous method, but 1.500using the semi-advantageous method. The advantageous method showssignificant improvement in that the column sum for the ideal method is1.119, which is only 2% off from the advantageous method. As a furthersign of overall improvement, an analysis of 1-pixel wide lines at allangles determined that the average column sums for the advantageousmethod and the ideal method differed by no more than 3.03% (compared to41% with the semi-advantageous method).

[0044] Similar absolute differences between the advantageous and idealmethods can be achieved on wider lines, while the difference inbrightness increases significantly for wider lines using thesemi-advantageous method. As it closely matches the ideal algorithm, theadvantageous algorithm will satisfy the Goals laid out above far betterthan the semi-advantageous one.

[0045] Accordingly, as this advantageous algorithm providessignificantly higher quality antialiased lines than the above-described(and other) semi-advantageous arrangements, the advantageous algorithmprovides an improved and acceptable low-cost platform for users of suchproducts.

[0046] With an example embodiment generally explained above, discussionnow turns to more theoretical analysis to further explain background andconcept, and eventually lead to further example embodiments of thepresent invention. Discussion turns first to background disadvantageousapproach so as to improve an understanding of the present invention.

[0047] Again, a good metric for accuracy of coverage calculations for anX-major line is the sum of coverages in each column (for Y-major lines,it is the sum of coverages in each row). FIG. 4 is a graphical depictionuseful in understanding a sum of coverage with respect to an exampleline segment versus an example column. Turning to FIG. 4, there iscomputed the ideal coverage, which is the area of a 1-pixel wideparallelogram (delineated by corners V, X, Y, Z). If w is the width ofthe line and 6 denotes the angle between the line A-B and the major axisC, the total area of the parallelogram is w/cos θ. This means that thecoverage for each column should increase with the angle θ. (Forconstant-length lines, the number of columns hit will decrease with θ.)

[0048] One semi-advantageous approach has gotten best results byprogramming a line width register to the true line width plus one pixel,and programming an antialiasing region register to “two pixels.” In thiscase, the column coverage for horizontal lines adds up to one. Thecolumn coverage for 45-degree (diagonal) lines, however, adds up to two,which is far above the theoretical value of sqrt(2)=1.414.

[0049] To continue, when the above approach generates virtual rectangleedges, it does so by tweaking the line equation. That is, for each edge,the hardware computes coefficients A, B and C, where the actual line isdefined by the (x,y) values where Ax+By+C=0. If we let AX denote thedifference in X values between the two endpoints (x1,y1) and (x2,y2),and ΔY denote the difference in Y values, then A, B and C are computedas:

A=?/(?X+?Y));(Eq. Ln. 8)

B=?X/(?X+?Y); and  (Eq. Ln. 9)

C=−(A*x1+B+y1).  (Eq. Ln. 10)

[0050] The expanded edges of the line are given by the equations:

Lo1(x,y)=Ax+By+C+K; and  (Eq. Ln. 11)

Lo2(x,y)=K−(Ax+By+C).  (Eq. Ln. 12)

[0051] To account for the line width, the constant K is simply set tow/2, where w denotes the programmed line width. For best results in thesemi-advantageous method, the programmed line width is set to w+1, wherew is the true line width specified by the application. In this approach,the column coverage for horizontal lines adds up to one. The columncoverage for 45-degree (diagonal) lines, however, as mentionedpreviously, adds up to two, which is far above the theoretical value ofsqrt(2)=1.414.

[0052] This expansion results in a rectangle similar to the idealrectangle. However, coverage is not computed directly. Instead, allpixels inside the boundaries of the rectangle are lit. The coverageapplied to a pixel for a given edge with a center at point P is definedsimply as: $\begin{matrix}{C = {{{Lo}(P)},}} & {{{{{if}\quad 0}<={{Lo}(P)} < 1};\quad {and}}} & {\left( {{Eq}.\quad {Ln}.\quad 13} \right)} \\{= {1,}} & {{{{if}\quad {{Lo}(P)}} > 1.}} & {{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\left( {{Eq}.\quad {Ln}.\quad 14} \right)}\end{matrix}$

[0053] For a given column, let P_(top) denote the y coordinate ofintersection of the top of the expanded rectangle with the center of thecolumn, P_(mid) denote the y coordinate of the intersection of thespecified line and the column center, and P_(bot) denote the ycoordinate of the intersection of the bottom of the expanded rectanglewith the column center.

[0054] For the top edge, it is known that the Lo(P_(top)) is 0, andLo(P_(mid)) is w/2. It is concluded then that the vertical distancebetween P_(top) and P_(mid) is:

w/2*(ΔX+ΔY)/ΔX.  (Eq. Ln. 15)

[0055] For a point P in the same column with a y coordinate betweenP_(top) and P_(mid), the computed coverage is:

MIN(1.0, (P−P_(top))*(ΔX/(ΔX+ΔY))).  (Eq. Ln. 16)

[0056] The same pattern occurs between P_(mid) and P_(bot). The overallcoverage ends up similar in appearance to FIG. 5.

[0057] When intersecting the rectangle with a column, this coveragecurve will be sampled at equally-divided points spaced by one pixel, andthe sum of the sampled values will reflect the coverage for a column. Onaverage, the coverage for a column will equal the area under the curve,which is: (W−1)*(ΔX+ΔY)/ΔX. Noting that ΔY/ΔX=tan θ and that the one mayprogram W as the real width plus one, the average column coverage endsup being:

w*(1+tan θ),  (Eq. Ln. 17)

[0058] instead of the ideal coverage of

w/cos θ.  (Eq. Ln. 18)

[0059] For one-pixel wide lines at 45 degrees, this means an averagecoverage of 2 instead of sqrt(2)=1.414. This results in significantlywider/brighter lines.

[0060] The other interesting characteristic of this algorithm is thatfor real lines, the coverage is sampled at points spaced one pixelapart. This means that the coverage sums can vary significantly simplybased on the position of the line. Consider an example where w=2(standard 1-pixel line and tan θ=0.5). The coverage pattern appearssimilar to FIG. 6.

[0061] In this example, let y denote the distance from P_(top) to thefirst pixel center sampled. Then the coverage curve is sampled atdistances y, y+1, and y+2 from P_(top). The sampled coverage value atdistance d is:

C(d)=⅔*d, with d<=1.5; and  (Eq. Ln. 19)

C(d)=⅔(3−d), with d>1.5.  (Eq. Ln. 20)

[0062] When adding the three samples, there are two cases:$\begin{matrix}{{{C_{sum}(y)} = {{C(y)} + {C\left( {y + 1} \right)} + {C\left( {y + 2} \right)}}};} & & {\left( {{Eq}.\quad {Ln}.\quad 21} \right)\quad} \\{= {{{2/3}*y} + {{2/3}*\left( {y + 1} \right)} + {{2/3}\left( {1 - y} \right),}}} & {{{{if}\quad y}<={0.5\quad {or}}}} & {\left( {{Eq}.\quad {Ln}.\quad 22} \right)} \\{{{{2/3}*y} + {{2/3}*\left( {2 - y} \right)} + {{2/3}\left( {1 - y} \right),}}} & {{{{{if}\quad y}\quad > 0.5};{and}}} & {\left( {{Eq}.\quad {Ln}.\quad 23} \right)} \\{= {{2/3}*\left( {2 + y} \right),}} & {{{{if}\quad y}<={0.5\quad {or}}}} & {\left( {{Eq}.\quad {Ln}.\quad 24} \right)} \\{{{2/3}*\left( {3 - y} \right),}} & {{{{if}\quad y} > {0.5.}}} & {{~~~~~~~~~~~~~~~~~~~~~}\left( {{Eq}.\quad {Ln}.\quad 25} \right)}\end{matrix}$

[0063] This means that, while the average sum is 1.5 (1+tan θ), one willget an actual sum of 1.33 when y=0, which increases to 1.66 when y=0.5,and then decreases again to 1.33 as y approaches 1. What this means (inthis example) is that the coverage sum for a column can vary by as muchas 25%. Fortunately, when going between columns, the y value willgenerally change (in this example it toggles between two values), so theoverall coverage of the line doesn't vary as widely.

[0064] Discussion turns next to figuring out a formula for coverage inthe ideal case, and thus attention is directed to FIG. 7. Let P0 denotethe y coordinate of the center of a 1×1 pixel square that just brushes,but is above, the edge of a properly expanded line-rectangle. P0 doesnot necessarily correspond to an actual pixel on the screen. P0 willprovide no coverage. Similarly, let P1 denote the y coordinate of thecenter of the pixel that just brushes, but is below, the same edge. P1will get full coverage. The distance between P0 and P1 turns out to be1+tan θ pixels, which is incidentally the same distance it takes for Loto go from 0 to 1 in the aforementioned hardware. This suggests that the“antialiasing region” algorithm of the aforementioned hardware, wherecoverage tails off in proportion to Lo, could be used to approximate thefalloff of actual coverage values.

[0065] The “antialiasing region” algorithm assumes that coverage dropsoff linearly with the distance from P0 to P1. That is not quite true.The function is broken into three pieces and is quadratic near P0 and P1and linear in the middle. It looks similar to FIG. 8. The solid curveshows coverage as a function of distance from P0; the dashed line showsthe linear approximation. The size of the curved areas is a function ofthe angle θ; the curve is almost entirely linear for nearly horizontallines and has almost no linear section for diagonal lines.

[0066] Other than the errors due to the linear coverage approximation,one other difference between the algorithms is the distance over whichcoverage is applied. This distance and the constant K applied to Lo inthe aforementioned algorithm are proportional, where:

D=K*(1+tan θ).  (Eq. Ln. 26)

[0067] In such algorithm, K is simply (w+1)/2, where w is the idealwidth of the line. Recall that the driver programs the hardware with thetrue width plus one, so the hardware simply adds w/2.

[0068] Turning next to the proposed algorithm, in the “ideal” algorithm(see FIG. 7), the distance D between P0 and P_(mid) is: $\begin{matrix}{D = {{w/\left( {2\quad \cos \quad \theta} \right)} + \frac{1}{2} + {\frac{1}{2}\quad \tan \quad \theta,}}} & & & {\left( {{Eq}.\quad {Ln}.\quad 27} \right)} \\{= {{w/\left( {2\quad \cos \quad \theta} \right)} + {\frac{1}{2}*{\left( {1 + {\tan \quad \theta}} \right).}}}} & & & {{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\left( {{Eq}.\quad {Ln}.\quad 28} \right)}\end{matrix}$

[0069] This means that the desired Lo constant K is simply D/(1+tan θ),or: $\begin{matrix}{{K = {{\left( {w/\left( {2\quad \cos \quad \theta} \right)} \right)/\left( {1 + {\tan \quad \theta}} \right)} + {\frac{1}{2},}}}\quad} & {\left( {{Eq}.\quad {Ln}.\quad 29} \right)} \\{= {{{w/2}*{1/\left( {{\sin \quad \theta} + {\cos \quad \theta}} \right)}} + {\frac{1}{2}\quad.}}} & {{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\left( {{Eq}.\quad {Ln}.\quad 30} \right)}\end{matrix}$

[0070]FIG. 9 depicts the coverage distribution for the same lineanalyzed earlier, where w=1 and tan θ=0.5. In this example, sin θ=0.447,cos θ=0.894, and (sin θ+cos θ)=1.342. K is computed to be 0.872 and D istherefore 1.308. The coverage distribution for the modified algorithm isshown shaded, and is overlaid on the coverage distribution for theoriginal algorithm. In this approach, the coverage applied is theminimum of the Lo values for the two expanded edges, since for narrowlines, the two Lo values will not reach 1.0 simultaneously. The averagecoverage sum is computed in the same way as before and is1.309*0.872=1.141. The theoretical coverage is 1/cos θ, or 1.119, for adifference of 2%. The difference between the average coverage using themodified algorithm and the theoretical coverage of 1/cos θ does notexceed 3.03% (at 45 degrees).

[0071] Turning next to conclusion, the semi-advantageous line drawingalgorithm can be adapted to produce overall results much closer to thoseof an ideal line drawing algorithm simply by tweaking the constant usedto modify the Lo values for the edges of the rectangle. Instead ofadding w/2 to Lo, the hardware should add:

[0072] ½+w/2* 1/(sin θ+cos θ)  (Eq. Ln. 31)

[0073] Therefore, a reasonable approximation of 1/(sin 0+cos 0) may beused to get a better distribution of line brightness.

[0074] For antialiased lines, errors in Lo are not significantlyserious. Such errors would drop or add pixels relative to thosegenerated via the “ideal” full-precision algorithm. However, all suchpixels would get next to nothing for coverage anyway, so such errorswould produce minimal error in the total coverage. This modifiedalgorithm has a deviation from the ideal coverage sum of no more thanapproximately 3%, not counting the error from approximating 1/(sin θ+cosθ).

[0075] Turning discussion next toward example implementation, an exampleembodiment of the present invention will be described using an examplesystem block diagram in an example personal computer (PC) system orenvironment. However, it is submitted that practice of the invention isnot limited thereto, i.e., the invention may be practiced with othertypes of systems, and in other types of environments.

[0076] Beginning such discussion, FIG. 10 is a block diagramillustrating an example personal computer (PC) system. Included withinsuch system may be a processor 112 (e.g., an Intel® Celeron® processor)connected to a system bus 114. Although only one processor 112 is shown,multiple processors may be connected to system bus 114. In an exampleembodiment, the chipset 110 may be a highly-integrated three-chipsolution including a graphics and memory controller hub (GMCH) 120, aninput/output (I/O) controller hub (ICH) 130 and a firmware hub (FWH)140.

[0077] The GMCH 120 may provide graphics and video functions and mayinterface one or more memory devices to the system bus 114. The GMCH 120may include a memory controller as well as a graphics controller (whichin turn may include various graphics sub-portions such as a3-dimensional (3D) engine, 2-dimensional (2D) engine, video engine,etc.). GMCH 120 may be interconnected to any of a system memory 150, alocal display memory 160, a display 170 (e.g., a computer monitor) andto a television (TV) via an encoder and a digital video output signal.GMCH 120 may be, for example, of a construction similar to an Intel®82810 or 82810-DC100 chip. The GMCH 120 also operates as a bridge orinterface for communications or signals sent between the processor 112and one or more 110 devices which may be connected to ICH 140. As shownin FIG. 10, the GMCH 120 includes an integrated graphics controller andmemory controller. However, the graphics controller and memorycontroller may be provided as separate components.

[0078] ICH 130 may interface one or more I/O devices to GMCH 120. FWH140 is connected to the ICH 130 and may provide firmware for additionalsystem control. The ICH 130 may be similar in construction to an exampleIntel® 82801 chip and the FWH 140 may be similar in construction to anexample Intel® 82802 chip. The ICH 130 may be connected to a variety ofI/O devices and the like, such as: a Peripheral Component Interconnect(PCI) bus 180 (e.g., PCI Local Bus Specification Revision 2.2 or higher)which may have one or more 110 devices connected to PCI slots 192, anIndustry Standard Architecture (ISA) bus option 194 and a local areanetwork (LAN) option 196; a Super I/O chip 190 for connection to amouse, keyboard and other peripheral devices (not shown); an audiocoder/decoder (Codec) and modem Codec; a plurality of Universal SerialBus (USB) ports (e.g., USB Specification, Revision 1.0 or higher); and aplurality of Ultra/66 AT Attachment (ATA) 2 ports (e.g., X3T9.2 948Dspecification or higher, commonly also known as Integrated DriveElectronics (IDE) ports) for receiving one or more magnetic hard diskdrives or other I/O devices.

[0079] With the above overview of an example system as background,discussion now turns more specifically to portions of the memorycontroller and/or graphics controller of the GMCH 120. FIG. 11 is ablock diagram illustrating a graphics and memory controller hub (GMCH)120 according to an example embodiment. The GMCH 120 may include agraphics controller 210 to provide graphics and video functions and amemory controller 230 to control and interface one or more memorydevices to the system bus 114. Memory controller 230 may be connected tothe system bus via a buffer 250 and a system bus interface 240. Thememory controller 230 may be connected to the ICH 130 via a buffer 260and hub interface 270. As noted above, GMCH 120 may be connected to asystem memory 150 and a local display memory 160.

[0080] The display memory 160 (also commonly referred to as video orgraphics memory typically provided on a video card or video memory card)is optional. In a lower cost embodiment known as a unified memoryarchitecture (UMA), the local display memory 160 is not present in thecomputer system. Rather, in the UMA embodiment, the system memory 150operates as both system memory and the local display memory. The UMAembodiment is less expensive because the cost for the separate localdisplay memory 160 is saved. However, the bandwidth or data rate overthe bus 151 between the GMCH 120 and the system memory 150 is typicallyvery limited. As a result, the UMA embodiment presents technicalchallenges to provide adequate graphics or video performance while usingonly the bandwidth-limited system memory 150 for storing and processingvideo frames for display.

[0081] The graphics controller 210 of GMCH 120 may include a displayengine 212 for displaying video or graphics images, a digital videooutput port 214 for outputting digital video signals on output 214D, a3D engine 216 for performing a variety of 3D graphics functions and a 2Dengine 218 for performing 2D functions. The 3D engine 216 performs avariety of functions including texture mapping, bilinear and anisotropicfiltering, MIP mapping, gouraud shading, alpha-blending, fogging andZ-buffering. The 2D engine 218 includes a blitter (BLT) engine 229 and astretch BLT engine 228 and for performing fixed blitter and stretchblitter operations, which refer to a block transfer of pixel databetween memory locations. The display engine 212 may include a hardwaremotion compensation engine 220 for performing motion compensation (e.g.,sub-stage 28 of FIG. 1). Overlay function 224 may perform a YUV to RGBcolor conversion, while DAC 222 may convert digital video to analogvideo signals which are output on 222A. Further, the GMCH 120 mayinclude a polygon/fantialiasing arrangement 157. That is, sucharrangement 157 may hardwired and/or programmed to provide antialiasingoperations in accordance with the aforementioned example embodiment(s),and may be provided separately from, or as part of, the graphicscontroller 210. Thus, when the system (or GMCH 120) requiresantialiasing services to be performed, example operations 1200 such asthose illustrated within FIG. 12 may be conducted.

[0082] More particularly, after a start 1202, an antialiasing command1210 may be issued and received. Thereafter, in an operation 1220,suitable information (e.g., line segment data, color data, etc.) may beprovided. The antialiasing arrangement 157 then performs antialiasingservices 1230 according to the aforementioned example embodiment(algorithm), and outputs 1240 antialiased graphics (e.g., pixel) data.Image or frame data (pixel data) is typically stored 1250 in the localdisplay memory 160 (when present) or stored in the system memory 150 inthe UMA embodiment, and ultimately may be displayed 1260 on (forexample) the display 170. Operation 1290 signifies an end.

[0083] Further example embodiments will be described with respect toFIGS. 13 and 14. More particularly, FIG. 13 is an example flowchart 1300concerning example operations conducted by a 3D engine of the FIGS. 10and 11 example embodiments. That is, the context here is the 3D Engine216 in FIG. 11. An operation 1304 concerns vertex transformation andclipping. Here primitives delimited by some number of vertices (1 forindividual points, 2 for lines, and 3 for triangles) are mapped from aglobal coordinate system onto the display screen. Primitives that do notproject onto the screen are rejected; primitives that fall off thescreen are “clipped” to become a primitive that corresponds to theintersection of the projection of the original primitive and the window.Additionally, other attributes such as colors and texture coordinatesare produced.

[0084] In an operation 1308, for all attributes (e.g., color) associatedwith a primitive, there is a computation (e.g., by hardware) ofcoefficients A, B, C where attribute (x,y)=Ax+By+C.

[0085] In an operation 1312, for each edge of the primitive (1 forlines, 3 for triangles), there is a computation of similar coefficientswhere Ax+By+C=0 along the edge.

[0086] In an operation 1316, a determination is made as to whether theprimitive in question is a line. If not, flow path 1324 is followed. Ifyes, i.e., if the primitive is a line, then in an operation 1320, thereis a computation of new coefficients for the equations:

Lo1(x,y)=(Ax+By+C)+K, and  (Eq. Ln. 32)

Lo2(x,y)=K−(Ax+By+C).  (Eq. Ln. 33)

[0087] This invention is primarily the method for computing the K forantialiased edges. Equations used for non-antialiased edges are somewhatdifferent.

[0088] Finally, in an operation 1328, a rasterization is performed,where rasterization is the process of determining which pixels should beilluminated by the primitive and how the final image is affected by theprimitive.

[0089]FIG. 14 is an example flowchart 1400 concerning example operationsconducted with respect to the FIG. 13 rasterization operation, i.e., thecontext here is the rasterization operation 1328 of FIG. 13. Thehardware first determines at a coarse level which pixels may be hit bythe primitive. For each such pixel, a corresponding “fragment” isproduced and the following steps are performed.

[0090] In an operation 1404, there is an evaluation of Lo(x,y) equationsfor each edge. For triangles, there would be three Lo values. Forantialiased lines, there are four (two above, and two corresponding tothe “end caps”, which was not an area of interest in this invention).

[0091] In an operation 1408, it is determined if any Lo(x,y) value isnegative. If so, the pixel is fully outside the corresponding edge, evenafter any edge expansion (as in operation 1320). If the pixel is outsidethe edge, the corresponding fragment may be discarded as indicated byoperation 1412.

[0092] In an operation 1416, the equations for attributes whosecoefficients were computed in operation 1308 are now evaluated at (x,y).This produces a resulting color, depth value (for sorting primitives),and set of texture coordinates for the fragment.

[0093] Next, in an operation 1420, it is determined if the primitiveshould be antialiased. If not, the coverage is set to 100% as shown byoperation 1424. If the primitive is antialiased, the portion of thepixel covered by the primitive should be computed as shown by operation1428. In the context of this invention, it may be computed by takingMIN(Lo1(x,y), Lo2(x,y)) and then accounting for end caps. In anoperation 1432, texture mapping (if applicable) may be performed, wheretexture coordinates are used to perform lookups into predefined imagesand modify the fragment's color.

[0094] Continuing, in an operation 1436, fog (if applicable) may beperformed, where distance from the viewer is used to fade distantprimitives to a constant fog color.

[0095] Next, in an operation 1440, the coverage factor (from operation1424 or 1428) may be multiplied by the fragment's alpha (opacity) toproduce a new alpha value. For example an 80% opaque fragment that onlycovers 50% of the pixel would get a new opacity of 40% (0.8*0.5).Finally, in an operation 1444, the fragment is combined with the colorof the frame buffer to get a new frame buffer value. In the exampleabove, if the fragment is white and the frame buffer pixel is black, theresulting frame buffer value will be 40% gray.

[0096] Accordingly, the FIG. 11 GMCH device 120 and/or the FIG. 10system are operative to effect improved antialiasing coveragecomputation embodiment of the present invention. By “operative,” it ismeant that a claimed item (e.g., device, system, etc.) has the properhardware, hardwiring and/or programming capable to accomplish thefeatures/limitations of the claimed invention, but does not necessarilymean that an item has to be operating to infringe.

[0097] In concluding, reference in the specification to “oneembodiment”, “an embodiment”, “example embodiment”, etc., means that aparticular feature, structure, or characteristic described in connectionwith the embodiment is included in at least one embodiment of theinvention. The appearances of such phrases in various places in thespecification are not necessarily all referring to the same embodiment.Further, when a particular feature, structure, or characteristic isdescribed in connection with any embodiment, it is submitted that it iswithin the purview of one skilled in the art to effect such feature,structure, or characteristic in connection with other ones of theembodiments. Furthermore, for ease of understanding, certain methodprocedures may have been delineated as separate procedures; however,these separately delineated procedures should not be construed asnecessarily order dependent in their performance, i.e., some proceduresmay be able to be performed in an alternative ordering, simultaneously,etc.

[0098] Further, embodiments of the present invention may be practiced atleast in part as a software invention, implemented in the form of amachine-readable medium having stored thereon at least one sequence ofinstructions that, when executed, causes a machine to effect theinvention. With respect to the term “machine”, such term should beconstrued broadly as encompassing all types of machines, e.g., anon-exhaustive listing including: computing machines, non-computingmachines, communication machines, etc. Similarly, which respect to theterm “machine-readable medium”, such term should be construed asencompassing a broad spectrum of mediums, e.g., a non-exhaustive listingincluding: magnetic medium (floppy disks, hard disks, magnetic tape,etc.), optical medium (CD-ROMs, DVD-ROMs, etc), etc.

[0099] This concludes the description of the example embodiments.Although the present invention has been described with reference to anumber of illustrative embodiments thereof, it should be understood thatnumerous other modifications and embodiments can be devised by thoseskilled in the art that will fall within the spirit and scope of theprinciples of this invention. More particularly, reasonable variationsand modifications are possible in the component parts and/orarrangements of the subject combination arrangement within the scope ofthe foregoing disclosure, the drawings and the appended claims withoutdeparting from the spirit of the invention. In addition to variationsand modifications in the component parts and/or arrangements,alternative uses will also be apparent to those skilled in the art.

1. An antialiasing device operative to effect antialiased line pixelsampling using polygon sampling rules, the antialiasing device effectingan expanded rectangle algorithm using a line-to-rectangle expansionmodifier of substantially K, where$K = {{\frac{w}{2}*\left( {1/\left( {{\cos \quad \theta} + {\sin \quad \theta}} \right)} \right)} + \frac{1}{2}}$

where w is a width in pixels of a line to be antialiased, and ? is anangle of the line from a predetermined reference axis.
 2. Anantialiasing device as claimed in claim 1, where the expanded rectanglealgorithm is operative to calculate, for each line, a quantity Lo(x,y)at each pixel (x,y) of Lo(x,y)=(ΔY/(ΔX+ΔY))*(x−x0)+(ΔX/(ΔX+ΔY))*(y−y0),where (x,y) give the coordinates of the pixel center, (x0,y0) and(x1,y1) are the endpoints of the line, and ΔX and ΔY are defined asx1−x0 and y1−y0, respectively, and where line-to-rectangle expansion iseffected with respect to the line defined by the endpoints (x0,y0) and(x1,y1).
 3. An antialiasing device as claimed in claim 1, where theantialiasing device comprises polygon rasterization hardware.
 4. Anantialiasing device as claimed in claim 1, where the antialiasing deviceis part of one of: a graphics chip and a graphics chipset.
 5. Anantialiasing means for effecting antialiased line pixel sampling usingpolygon sampling rules, the antialiasing means for effecting an expandedrectangle algorithm using a line-to-rectangle expansion modifier ofsubstantially K, where$K = {{\frac{w}{2}*\left( {1/\left( {{\cos \quad \theta} + {\sin \quad \theta}} \right)} \right)} + \frac{1}{2}}$

where w is a width in pixels of a line to be antialiased, and ? is anangle of the line from a predetermined reference axis.
 6. Anantialiasing means as claimed in claim 5, where the expanded rectanglealgorithm is operative to calculate, for each line, a quantity Lo(x,y)at each pixel (x,y), of Lo(x,y)=(ΔY/(ΔX+ΔY))*(x−x0)+(ΔY/(ΔX+ΔY))*(y−y0),where (x,y) give the coordinates of the pixel center, (x0,y0) and(x1,y1) are the endpoints of the line, and ΔX and ΔY are defined asx1−x0 and y1−y0, respectively, and where line-to-rectangle expansion iseffected with respect to the line defined by the endpoints (x0,y0) and(x1,y1).
 7. An antialiasing means as claimed in claim 5, where theantialiasing means comprises polygon rasterization hardware means forperforming polygon rasterization services and antialisaing services. 8.An antialiasing means as claimed in claim 5, where the antialiasingmeans is part of one of: a graphics chip and a graphics chipset.
 9. Asystem comprising: at least one of a local graphics memory array, adisplay and a power supply; and an antialiasing device operative toeffect antialiased line pixel sampling using polygon sampling rules, theantialiasing device effecting an expanded rectangle algorithm using aline-to-rectangle expansion modifier of substantially K, whereK=w/2*(1/(cos ?+sin ?)+½ where w is a width in pixels of a line to beantialiased, and ? is an angle of the line from a predeterminedreference axis.
 10. A system as claimed in claim 9, where the expandedrectangle algorithm is operative to calculate, for each line, a quantityLo(x,y) at each pixel (x,y), ofLo(x,y)=(ΔY/(ΔX+ΔY))*(x−x0)+(ΔX/(ΔX+ΔY))*(y−y0), where (x,y) give thecoordinates of the pixel center, (x0,y0) and (x1,y1) are the endpointsof the line, and ΔX and ΔY are defined as x1−x0 and y1−y0, respectively,and where line-to-rectangle expansion is effected with respect to theline defined by the endpoints (x0,y0) and (x1,y1).
 11. A system asclaimed in claim 9, where the antialiasing device comprises polygonrasterization hardware.
 12. A system as claimed in claim 9, where theantialiasing device is part of one of: a graphics chip and a graphicschipset.
 13. An antialiasing method comprising: effecting antialiasedline pixel sampling using polygon sampling rules, by effecting anexpanded rectangle algorithm using a line-to-rectangle expansionmodifier of substantially K, where K=w/2*(1/(cos ?+sin ?)+½, where w isa width in pixels of a line to be antialiased, and is an angle of theline from a predetermined reference axis.
 14. An antialiasing method asclaimed in claim 13, where the expanded rectangle algorithm comprises:calculating, for each line, a quantity Lo(x,y) at each pixel (x,y), ofLo(x,y)=(ΔY/(ΔX+ΔY))*(x−x0)+(ΔX/(ΔX+ΔY))*(y−y0), where (x,y) give thecoordinates of the pixel center, (x0,y0) and (x1,y1) are the endpointsof the line, and ΔX and ΔY are defined as x1−x0 and y1−y0, respectively,and where line-to-rectangle expansion is effected with respect to theline defined by the endpoints (x0,y0) and (x1,y1).
 15. An antialiasingmethod as claimed in claim 13, where the antialiasing method isperformed at least in part by polygon rasterization hardware.
 16. Anantialiasing method as claimed in claim 15, where the polygonrasterization hardware is part of one of: a graphics chip and a graphicschipset.
 17. A machine-readable medium having stored thereon at leastone sequence of instructions that, when executed, causes a machine to:effect antialiased line pixel sampling using polygon sampling rules, byeffecting an expanded rectangle algorithm using a line-to-rectangleexpansion modifier of substantially K, where K=w/2*(1/(cos ?+sin ?)+½,where w is a width in pixels of a line to be antialiased, and is anangle of the line from a predetermined reference axis.
 18. A medium asclaimed in claim 17, where the expanded rectangle algorithm comprises:calculating, for each line, a quantity Lo(x,y) at each pixel (x,y), ofLo(x,y)=(ΔY/(ΔX+ΔY))*(x−x0)+(ΔX/(ΔX+ΔY))*(y−y0), where (x,y) give thecoordinates of the pixel center, (x0,y0) and (x1,y1) are the endpointsof the line, and ΔX and ΔY are defined as x1−x0 and y1−y0, respectively,and where line-to-rectangle expansion is effected with respect to theline defined by the endpoints (x0,y0) and (x1,y1).